<template>
	<view>
		<view class="flex-center-sb item-back" @click="selectAddress">
			<view>
				<view class="flex-center">
					<view class="name-text">{{addressInfo.name}}</view>
					<view class="mobile-text">{{addressInfo.mobile}}</view>
				</view>
				<view class="address-text">
					地址：{{addressInfo.province}}{{addressInfo.city}}{{addressInfo.district}}{{addressInfo.address}}
				</view>
			</view>
			<image class="arrow-image" src="../../static/arrow.png"></image>
		</view>
		<view class="goods-back">
			<view class="goods-item" v-for="(goods,index) in orderInfo.goods">
				<image class="goods-image" :src="goods.image"></image>
				<view class="goods-msg">
					<view class="goods-name">{{goods.title}}</view>
					<view>
						<view class="flex-center-sb number">
							<view>规格：</view>
							<view>X{{goods.number}}</view>
						</view>
						<view class="flex-center-sb">
							<view class="price">¥ {{goods.price}}</view>
						</view>
					</view>

				</view>
			</view>
			<view class="flex-center-sb goods-item">
				<view>备注</view>
				<input class="remark" placeholder="建议留言前先与商家沟通" v-model="remarks" />
			</view>
		</view>
		<view class="goods-back">
			<view class="flex-center-sb goods-item">
				<view>商品金额：</view>
				<view class="price-text">¥ {{orderInfo.order_price}}</view>
			</view>
			<view class="flex-center-sb goods-item">
				<view>运费：</view>
				<view class="price-text">¥ {{orderInfo.freight_price}}</view>
			</view>
			<view class="flex-center-sb goods-item">
				<view>抵扣金额：</view>
				<view class="price-text">-¥ {{orderInfo.coupon_price}}</view>
			</view>
			<view class="flex-center-end goods-item">
				<view>总计：</view>
				<view class="all-price">¥ {{orderInfo.sub_price}}</view>
			</view>
		</view>
		<view class="bottomBt">
			<view class="bottom-price"><text>¥</text>{{orderInfo.sub_price}}</view>
			<view class="button" @click="submitOrder">提交订单</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "wts-confirmOrder",
		props: {
			addressInfo: '',
			orderInfo: ''
		},
		data() {
			return {
				remarks: ''
			}
		},
		watch: {

		},
		methods: {
			// 选择地址
			selectAddress() {
				this.$emit('selectAddress')
			},
			// 提交订单
			submitOrder() {
				let params = {

				}
				this.$emit('submitOrder', params)
			}
		}
	}
</script>

<style lang="scss">
	.flex-center {
		display: flex;
		align-items: center;
	}

	.flex-center-sb {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.flex-center-end {
		display: flex;
		align-items: center;
		justify-content: flex-end;
	}

	.item-back {
		background-color: #fff;
		padding: 30rpx;
		margin-top: 20rpx;
		font-size: 28rpx;
	}

	.name-text {
		width: 200rpx;
		font-weight: bold;
	}

	.mobile-text {
		color: #444;
	}

	.address-text {
		color: #666;
		margin-top: 20rpx;
	}

	.arrow-image {
		width: 50rpx;
		height: 50rpx;
	}

	.goods-back {
		margin-top: 20rpx;

		.goods-item {
			display: flex;
			padding: 30rpx;
			background-color: #fff;
			border-bottom: #eee 2rpx solid;
			font-size: 28rpx;

			.goods-image {
				width: 180rpx;
				height: 180rpx;
			}

			.goods-msg {
				margin-left: 20rpx;
				flex: 1;
				height: 180rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;

				.goods-name {
					-webkit-line-clamp: 2;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					overflow: hidden;
					text-overflow: ellipsis;
				}

				.number {
					color: #666;
					margin-bottom: 10rpx;
				}

				.price {
					color: #a20000;
					font-size: 32rpx;
					font-weight: bold;
				}
			}

			.remark {
				font-size: 28rpx;
				flex: 1;
				text-align: right;
			}

			.price-text {
				color: #666;
			}

			.all-price {
				font-size: 36rpx;
				font-weight: bold;
				color: #a20000;
			}

			&:last-of-type {
				border-bottom: none;
			}
		}
	}

	.bottomBt {
		width: 100%;
		padding: 20rpx;
		box-sizing: border-box;
		background: #fff;
		position: fixed;
		left: 0;
		bottom: 0;
		border-top: 1px solid #eee;
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx);
		z-index: 999;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.bottom-price {
			font-size: 40rpx;
			font-weight: bold;
			color: #a20000;

			text {
				font-size: 30rpx;
			}
		}

		.button {
			background-color: #a20000;
			color: #fff;
			height: 88rpx;
			width: 260rpx;
			border-radius: 44rpx;
			line-height: 88rpx;
			text-align: center;
		}
	}
</style>